// const app = require('express')()

//导入数据库操作模块
const db = require("../../db/index")

/**
 * 获取学习视频列表
 * @param {*} req 
 * @param {*} res 
 */
exports.getStudyVideosList = async (req, res) => {
    console.log('获取学习视频列表')
    const sql = `SELECT videos.id,videos.title,tags.tag_name AS tags,videos.description,videos.video_url,videos.flag FROM xks_study_videos AS videos, xks_tags AS tags WHERE tags.tag_type = "学习视频" AND videos.id=tags.c_id `;
    await db.query(sql, (err, results) => {
        if (err) {
            return res.send({
                code: 505,
                msg: '获取失败，发送了错误' + err.message,
                data: {}
            })
        }
        return res.send({
            code: 200,
            msg: '成功',
            data: {
                list: results
            }
        })
    })
}

